package com.cloud.hystrix.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import com.cloud.hystrix.entity.Person;
import com.cloud.hystrix.service.PersonBaseUserService;
import com.cloud.hystrix.service.PersonService;

@RestController
public class InvokerController {

	@Autowired
	PersonService personService;
	@Autowired
	PersonBaseUserService personBaseUserService;

	/**
	 * @URLparam 订单
	 * @param
	 * @return
	 */
	@PostMapping(value = "/post", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
	public Person get(@RequestBody Person person) {
		return personService.findPerson(person);
	}

	@GetMapping(value = "/getPerson", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
	public Person getPerson() {
		return personBaseUserService.getPerson();
	}
}
